﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Simple.Common
/// <summary>
/// 版 本 钢易智企2.0 V 2.0.0 钢易智企2.0
/// Copyright (c) 2023 杭州钢易科技有限公司
/// 创建人：曾东明
/// 日 期：2024
/// 描 述：
/// </summary>
{
	public class BaseMessage
	{
		/// <summary>
		/// 
		/// </summary>
		public BaseMessage(string message,int code)
		{
			Message = message;
			Code = code;
		}

		public BaseMessage(string message)
		{
			Code = 200;
			Message = message;
		}

		public BaseMessage(int code)
		{
			this.Code = code;
			Message = "成功!";
		}
		public BaseMessage()
		{
			Code = 200;
			Message = "成功!";
		}

		/// <summary>
		/// 200 成功
		/// 500 服务器错误
		/// 
		/// </summary>
		public int Code { get; set; }
		/// <summary>
		/// 
		/// </summary>
        public string Message { get; set; }

		public TMessage GetMessage<TMessage>()
		{
			if (this is TMessage tMessage)
			{
				return tMessage;
			}
			return default(TMessage);
		}
    }
}
